import { NzModalService } from 'ng-zorro-antd/modal';
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
import { CodeItemPanleData } from './models';
import { Tools } from 'src/app/common/tools/tools';

@Component({
  selector: 'zepride-org-code-item',
  templateUrl: './org-code-item.component.html',
  styleUrls: ['./org-code-item.component.less']
})
export class OrgCodeItemComponent implements OnInit {
  _onSaveEvent = {
    key: Tools.GetGuid(),
    handle: null
  }
  onDeleteEvent = {
    key: Tools.GetGuid(),
    handle: null
  }
  constructor(
    private modal: NzModalService
  ) { }

  @Input() codeItemPanleData: CodeItemPanleData;
  @Output() delete: EventEmitter<any> = new EventEmitter<any>();

  ngOnInit(): void {
  }

  delCodePanel() {
    this.modal.confirm({
      nzTitle: `提示信息`,
      nzContent: `是否要删除此编码？`,
      nzOkText: '删除',
      nzOkType: 'danger',
      nzOnOk: async () => {
        this.onDeleteEvent.handle();
        this.delete.emit(this.codeItemPanleData);
      },
      nzCancelText: '取消',
      nzOnCancel: () => { }
    });
  }
}

